package com.xinchuang.controller.targetSystem;

import com.alibaba.fastjson.JSONObject;
import com.xinchuang.comment.R;
import com.xinchuang.service.targetSystem.target.IndexTableService;
import javafx.geometry.Pos;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author zkwczx
 * @version 1.0
 * @date 2024/4/15 16:09
 */
@RequestMapping(value = "/eyefinger")
@RestController
@RequiredArgsConstructor
public class IndexTableController {

    private final IndexTableService indexTableService;

    @PostMapping(value = "/addOrUpdate")
    public R addIndexTable(
            @RequestBody JSONObject json
            ) {
        return indexTableService.addIndexTable(json);
    }

    @PostMapping(value = "/delete")
    public R deleteIndexTable(
            @RequestBody JSONObject json
    ) {
        return indexTableService.deleteIndexTable(json);
    }

    @PostMapping(value = "/selectList")
    public R indexTableList(
            @RequestBody JSONObject json
    ) {
        return indexTableService.selectIndexList(json);
    }

    @PostMapping(value = "/selectOne")
    public R indexTableOnly(
            @RequestBody JSONObject json
    ) {
        return indexTableService.selectIndexOne(json);
    }

    @PostMapping(value = "/Map")
    public R map(
            @RequestBody JSONObject json
    ) {
        return indexTableService.selectIndexAll(json);
    }

    @PostMapping(value = "/MapOne")
    public R mapOne(
            @RequestBody JSONObject json
    ) {
        return indexTableService.selectIndexMapOne(json);
    }

    @PostMapping(value = "/calculate")
    public R calculate(
            @RequestBody JSONObject json
    ) {
        return indexTableService.calculateIndexOne(json);
    }

}
